//*************************************************************************
//  Header Datei RDS.H
//
//  contact: sebastian.trommer@gmail.com
//  homepage: wiki.car2.de
//
//  Revision History
//
//  when         what  who	why
//
//  2009-01-05   0.01  TSE	initial release
//	2009-02-23	 0.02  TSE  Code reorganisiert aus altem Projekt
//
//**************************************************************************

#ifndef RDS_H
#define RDS_H

// start RDS blocks
volatile uint16_t RDS_blockA = 0xD000;
volatile uint16_t RDS_checkA = 0x167;
volatile uint16_t RDS_blockB;
volatile uint16_t RDS_checkB;
volatile uint16_t RDS_blockC;
volatile uint16_t RDS_checkC;
volatile uint16_t RDS_blockD;
volatile uint16_t RDS_checkD;

volatile uint16_t naechste_ausgabe_norm;
volatile uint16_t bm_naechste_ausgabe_norm = 0;
volatile uint16_t naechste_ausgabe_diff;
volatile unsigned char stelle;
volatile unsigned char diffcodedvorher = 1;
volatile unsigned char TP = 		1; // traffic transmission
volatile unsigned char PTY = 0x1F; // programme type -> science
volatile unsigned char TEXTAB = 1;
volatile unsigned char block_fertig;
volatile unsigned char k = 0;

volatile uint16_t generatormatrix[16] = {
		0b0001110111,0b1011100111,0b1110101111,0b1100001011,
		0b1101011001,0b1101110000,0b0110111000,0b0011011100,
		0b0001101110,0b0000110111,0b1011000111,0b1110111111,
		0b1100000011,0b1101011101,0b1101110010,0b0110111001};

volatile uint16_t offsetword[5] = {
		0b0011111100,0b0110011000,0b0101101000,0b1101010000,0b0110110100};

volatile uint16_t *gm = &generatormatrix[0]; // pointer on generatormatrix

volatile unsigned char text[64] = {
		'F','A','C','H','H','O','S','C','H','U','L','E',' ','A','U','G','S','B','U','R','G',' ','R','D','S','-','T','E','S','T',0x17};
volatile unsigned char *ptr_text;

extern void RDS_init();
extern void RDS_textausgeben();
extern void RDS_pruefwort();
extern void RDS_makeblockB();
extern void RDS_textblock();
extern void RDS_out();
extern void RDS_nextbit();
#endif
